package edu.hawaii.duedates.datastore;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import edu.hawaii.duedates.libraries.ILibrary;
import edu.hawaii.duedates.libraries.UhLibrary;
import org.junit.Test;

/**
 * Some tests to check that the User class functions as expected.
 * @author Daniel Arakaki, Arthur Shum, Daniel Tian, Jeho Jung
 *
 */
public class TestUser {  
  
  private final User user = new User("Test Name", "Test@email.com", "Test Password");
  
  /**
   * Test get methods returns correct value.
   * @throws Exception If an error occurs during the test.
   */
  @Test
  public void testUser() throws Exception {
    assertFalse("Test invalid user", user.isValidUser(null, null));
    assertTrue("Test valid user", user.isValidUser("Test@email.com", "Test Password"));
    
    assertEquals("Get name", "Test Name", user.getName());
    assertEquals("Get email", "Test@email.com", user.getEmail());
    
    ILibrary testLibrary = new UhLibrary();
    this.user.addLibrary(testLibrary);    
    assertFalse("libraryList shouldn't be empty", this.user.getLibraryList().isEmpty());
  }
}
